package gererg;

/**
 * @author leon(liangzou0318@gmail.com)
 * @date 2012-5-1
 * @filaname GongYueShu.java
 */
public class GongYueShu {
      public int gcd(int a,int b){
    	  if(a<b){int temp=a;a=b;b=temp;}
        	  while(a>0&&b!=0){
    		  int r=a%b;
    		  a=b;
    		  b=r;
    	  }
    	  return a;
      }
      public int lcm(int a,int b){
    	  return a*b/gcd(a,b);
      }
	public static void main(String[] args) {
		 GongYueShu gongyueshu=new GongYueShu();
		 int m=9;
		 int n=21;
		 int t=gongyueshu.gcd(m, n);
		 int k=gongyueshu.lcm(m, n);
		 System.out.println("gcm: "+t+" lcm "+k);
	}

}
